<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        let data = [{name:1,value:1},{name:1,value:2},{name:1,value:3},{name:2,value:1},{name:2,value:2},{name:3,value:3}]
        let templateArr= [];
        data.forEach((item) => {
          let isAll = true;
          templateArr.forEach((items, index) => {
            if (templateArr[index][item.name]) {
              isAll = false;
              templateArr[index][item.name].push(item);
            }
          });
          if (isAll) {
            templateArr.push({ [item.name]: [item.value] });
          }
        });
        console.log(templateArr);
        
    </script>
</body>
</html>